//
//  PlazaTableViewCell.swift
//  XMYouPin
//
//  Created by 王宗成 on 2019/7/7.
//  Copyright © 2019 王宗成. All rights reserved.
//

import UIKit

class PlazaTableViewCell: WZC_TableViewCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        
    }
    var model:HomeFloorModel?
    {
        willSet
        {
            if self.model?.floor_id != newValue?.floor_id {
                
                let width:CGFloat = (kScreenW-5*3)/4
                let rate:CGFloat =  363.0/244.0
                let heigth:CGFloat = width*rate - 10
                
                for i in 0...1
                {
                    for j in 0...3{
                        
                        let imgView:UIImageView = UIImageView(frame: CGRect(x: 3.0+CGFloat(j)*(width+3.0), y: 3.0+CGFloat(i)*(heigth+3.0), width: width, height: heigth))
                        imgView.kf.setImage(with: URL(string: (newValue?.data?.rows[i].items[j].item!.pic_url)!))
                        self.contentView.addSubview(imgView)
                        
                    }
                }
            }
        }
    }
    
   
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.contentView.backgroundColor = .white
        
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }

}
